current 1.2 - 4th September 2024
version | date | comment |
---|---|---|
1.0 | 14/Feb/2013 | Original code |
1.1 | 11/Feb/2021 | FileDir for returning list of files in a directory |
1.2 | 04/Sep/2024 | FileSyncToLastLine for synchronizing to the last line of formatted file |
license: GNU GPL http://www.gnu.org/licenses/
This file is part of
MOSAICO -- MOdular library for raSter bAsed hydrologIcal appliCatiOn.
Copyright (C) 2011 Giovanni Ravazzani
This module is designed to provide basic file and directory management and system operations for Windows and Linux based operating systems. For setting operating system, code pre processing (FPP) is used
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public, | parameter | :: | UNIX | = | 2 | |
integer, | public, | parameter | :: | WIN32 | = | 1 |
return current directory
returns TRUE if directory exists
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | dir |
returns TRUE
if file exists
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | file |
get operating system
delete a directory
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | dir |
return a list of files in a directory
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | dir | |||
character(len=*), | intent(out) | :: | list | |||
integer(kind=short), | intent(out) | :: | nfiles | |||
character(len=*), | intent(in), | optional | :: | filext |
create a new directory
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | dir |
rename a directory
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | dir | |||
character(len=*), | intent(in) | :: | dir2 |
delete a file
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | file |
create a new text file
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | file |
rename a file. If renamed file already exists it is not overwritten and warning is raised.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | file | |||
character(len=*), | intent(in) | :: | file2 |
synchronize to the last line of formatted file
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=short), | intent(in) | :: | fileUnit |
unit of file to sync |
||
integer(kind=short), | intent(in) | :: | blanks |
number of blank lines to add |
Erase lines except the number specified as argument. pos defines wheter kept lines are counted starting from the beginning or from the end of file. Optional argument header defines number of lines at the beginning of the file to be considered as header. Header lines are never deleted. Manipulated file is supposed to be already opened.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=short), | intent(in) | :: | fileUnit | |||
integer(kind=short), | intent(in) | :: | lines | |||
character(len=*), | intent(in) | :: | pos |
possible value: first, last |
||
integer(kind=short), | intent(in), | optional | :: | header |